/** @jsxImportSource @emotion/react */
import * as React from "react";
import {CCell, Cell, Table, TableBody, TableRow, Text,} from "customize-easy-ui-component";
import {DirectLink,} from "../../../routing/Link";
import {RepLink,} from "../../common/base";
import {usePrefixDataTable} from "../../hook/usePrefixData";
import Img_Seal from "../../../images/seal.png";
import {检验编制核准ForkW} from "../flWeituo/repView";

//仅在正式报告用，而非原始记录采用的：无需纳入编辑器检查；
const config设备 = [
  [['使用单位名称', '_$使用单位'], ],
  [['使用单位地址', '_$使用单位地址'] ],
  [['分支机构', '_$分支机构'] ],
    //联系人 =安全管理员    联系电话 =安全管理员移动电话
  [['联系人', '安全员'], ['联系电话', '安全员电'] ],
  [['统一社会信用代码', '_$使用单位信用码'], ],
  [['制造单位名称', '_$制造单位'] ],
  [['改造单位名称','_$改造单位']],
  [['修理单位名称','_$维修单位']],
  [['产品名称', '_$设备名称'],  ],
  [['产品型号', '_$型号'], ['产品编号', '_$出厂编号'], ],
  [['车架编号', '_$底盘编号'], ['发动机(行走电机)编号', '_$发动机号'] ],
  [['额定起重量','_$额定载荷','kg'],  [{pr:'防爆', span:3, t:'设备保护级别'},  '_$防爆等级'] ],
  [['动力方式','_$动力方式'],  [{t:'气体/粉尘组别'},  '粉尘组'] ],
  [['传动方式', '_$传动方式'],  [{t:'温度组别'},  '温度组'] ],
  [['车架结构', {n:'车架构',t:'l'}], ['驾驶方式', {n:'驾驶式',t:'l'}],  ],
  [['自重', '_$自重量','kg'],  ['空载最大运行速度', '_$运行速度','km/h'], ],
  [['空载最大起升高度', '_$最大升高','mm'],   ],
  [['检验依据',{r:'参照《场（厂）内专用机动车辆安全技术规程》(TSG 81－2022)'}] ],
];

export const 报告设备详情= ( {theme, orc, rep } : { orc: any,rep:any, theme:any}
) => {
  const renderUpper=usePrefixDataTable({config: config设备, orc, rep, slash:true});
  return <React.Fragment>
    <Table id={'Survey'} fixed={ ["6.1%","10%","37%","3%","13.5%","%"] }  css={ {borderCollapse: 'collapse' } }  tight  miniw={800}>
      <TableBody>
        <RepLink rep={rep} tag={'Survey'}>
          {renderUpper}
        </RepLink>
      </TableBody>
    </Table>
    <Table fixed={ ["4.8%","12.7%","24%","9%","12.2%","7%","%"] }  css={ {borderCollapse: 'collapse' } }  tight  miniw={800}>
      <TableBody>
        <DirectLink href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/Conclusion#Conclusion`}>
          <TableRow>
            <CCell>检验结论</CCell><CCell colSpan={6}><Text variant="h1" css={{fontSize:'2.2rem',letterSpacing: '1rem'}}>{orc?.检验结论}</Text></CCell>
          </TableRow>
        </DirectLink>
        <DirectLink href={`/report/${rep?.modeltype}/ver/${rep?.modelversion}/${rep?.id}/Witness#Witness`}>
          <TableRow>
            <CCell>备注</CCell>
            <Cell split={true} colSpan={6}><div css={{minHeight: '1rem', whiteSpace: 'pre-wrap'}}>
              {orc.大备注 ?? '／'}
            </div></Cell>
          </TableRow>
        </DirectLink>
        <TableRow>
          <CCell colSpan={2}>检验日期</CCell><CCell colSpan={5}>{orc?.检验日期}</CCell>
        </TableRow>
      </TableBody>
    </Table>
  </React.Fragment>;
};
